//
//  BCConversionCurrencyFeesCell.m
//  GSBlockChain
//
//  Created by guoshikeji_a on 2019/1/7.
//  Copyright © 2019 guoshikeji. All rights reserved.
//

#import "BCConversionCurrencyFeesCell.h"

@implementation BCConversionCurrencyFeesCell

- (void)setCellModel:(BConversionCellModel *)cellModel {
    [super setCellModel:cellModel];
}

- (void)setConversionData:(BCConversionData *)conversionData {
    [super setConversionData:conversionData];
    //
    BCConversionDataTickerModel *ticker = conversionData.currentTicker;
    //
    if (ticker) {
        NSString *sign = ticker.sign;
        NSString *fee;
        if (ticker.handling_type==BCUserWalletCashDataHandlingType_2) {//
            NSString *amount = conversionData.conversionAmount;
            if (amount.length) {
                CGFloat amountValue = amount.floatValue;
                amountValue = amountValue*ticker.last;
                CGFloat realAmountValue = amountValue*ticker.handling;
                fee = [NSString stringWithFormat:@"%@",@(realAmountValue)];
            }else {
                fee = @"--";
            }
        }else {
            fee = [NSString stringWithFormat:@"%@",@(ticker.handling)];
        }
        self.contentLabel.text = [NSString stringWithFormat:@"≈ %@ %@",fee,sign];
    }else {
        self.contentLabel.text = nil;
    }
}

@end
